#ifndef OPENFILEDESCTABLE_H_
#define OPENFILEDESCTABLE_H_

#include <map>
#include <utility>
using namespace std;
#include <iostream>

struct fileDesc
{
	int filePos;
	int inode;
	int permissions;
};

class OpenFileDescTable
{
public:
	OpenFileDescTable();
	virtual ~OpenFileDescTable();
	int AddFile(int inode,int perm);
	void RemoveFile(int fd);
	void moveFd(int fd, int n);
	int getInodeByFd(int fd);
	int getOffsetByFd(int fd);


private:
	static const int maxFiles = 128;
	map<int,fileDesc> _table;
	int _nextFreeFD;

	void InitTable();
	bool setNextFD();


};


#endif /*OPENFILEDESCTABLE_H_*/
